package org.agony2d.view 
{
	import flash.display.DisplayObject;
	import org.agony2d.core.agony_internal;
	import org.agony2d.view.core.Component;
	import org.agony2d.view.core.ComponentProxy;
	import org.agony2d.view.core.FusionComp;
	import org.agony2d.view.core.IComponent;
	
	use namespace agony_internal;
	
	/** 合体
	 *  [◆]
	 * 		1. numElement
	 * 		2. headElement
	 * 		3. tailElement
	 *  [◆◆]
	 *		1. addElement
	 * 		2. addElementAt
	 * 		3. getElementByName
	 * 		4. getElementAt
	 * 		5. setElementIndex
	 * 		6. removeAllElement
	 */
public class Fusion extends ComponentProxy
{
	
	public function Fusion()
	{
		m_view = FusionComp.getFusionComp(this);
	}
	
	final public function get numElement() : int { return m_view.m_numElement }
	
	final public function get headElement() : IComponent { return m_view.headElement }
	
	final public function get tailElement() : IComponent { return m_view.tailElement }
	
	final public function addElement( c:IComponent, paddingX:Number = 0, paddingY:Number = 0, spaceCode:int = 257 ) : void 
	{
		return m_view.addElementAt(c, -1, paddingX, paddingY, spaceCode);
	}
	
	final public function addElementAt( c:IComponent, index:int, paddingX:Number = 0, paddingY:Number = 0, spaceCode:int = 257 ) : void 
	{
		return m_view.addElementAt(c, index, paddingX, paddingY, spaceCode);
	}
	
	final public function getElementByName( name:String ) : IComponent 
	{
		return m_view.getElementByName(name);
	}
	
	final public function getElementAt( index:int = 0 ) : IComponent
	{
		return m_view.getElementAt(index)
	}
	
	final public function setElementIndex( c:IComponent, index:int ) : void
	{
		m_view.setElementIndex(c, index)
	}
	
	final public function removeAllElement() : void
	{
		m_view.removeAllElement();
	}
	
	final override agony_internal function get view() : Component { return m_view }
	
	override agony_internal function get shell() : DisplayObject { return m_view }
	
	agony_internal var m_view:FusionComp
}
}